<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
async function doSomething(){
    console.log('执行doSomething')
    return '执行doSomething'
}
async function testAsync(){
    console.log('testAsync')
    return  Promise.resolve('hello async')
}
async function mainfun(){
    console.log('testStart')
    let v1=await doSomething()
    console.log(v1)
    let v2= testAsync()
    console.log(v2)

}
mainfun()
var promise = new Promise((resolve)=> { console.log("promise start.."); resolve("promise");});//关键点2
promise.then((val)=> console.log(val));
console.log('testend')
    </script>
</body>
</html>